//
//  OfflineManager.m
//  SXH
//
//  Created by 朱伟 on 16/5/5.
//  Copyright © 2016年 lyss. All rights reserved.
//

#import "OfflineManager.h"

@implementation OfflineManager

/**
 *  根据类名保存数组
 */
+ (void)saveOfflineDataWithArr:(NSMutableArray *)arr andName:(NSString *)name {
    NSUserDefaults *userDefault = [NSUserDefaults standardUserDefaults];
    [userDefault setObject:arr forKey:name];
}

/**
 *  根据类名取到数组
 */
+ (NSMutableArray *)getoutArrDataWithName:(NSString *)name {
    NSUserDefaults *userDefault = [NSUserDefaults standardUserDefaults];
    NSMutableArray *arr = [[userDefault objectForKey:name] mutableCopy];
    if (arr == nil) {
        arr = [[NSMutableArray alloc]init];
    }
    return arr;
}

/**
 *  根据类名保存字典
 */
+ (void)saveOfflineDataWithDict:(NSMutableDictionary *)dict andName:(NSString *)name {
    NSUserDefaults *userDefault = [NSUserDefaults standardUserDefaults];
    [userDefault setObject:dict forKey:name];
}

/**
 *  根据类名取到字典
 */
+ (NSMutableDictionary *)getoutDictDataWithName:(NSString *)name {
    NSUserDefaults *userDefault = [NSUserDefaults standardUserDefaults];
    NSMutableDictionary *dict = [userDefault objectForKey:name];
    if (dict == nil) {
        dict = [[NSMutableDictionary alloc]init];
    }
    return dict;
}



@end
